package tech.xs.sys.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import tech.xs.common.framework.domain.annotations.Dict;
import tech.xs.common.framework.domain.annotations.DictData;
import tech.xs.common.framework.domain.constant.ModuleNames;
import tech.xs.common.framework.domain.enums.BaseEnum;

import java.util.HashMap;
import java.util.Map;

@Dict(code = "SysWebMenuShowType", name = "菜单展示类型")
public enum SysWebMenuShowType implements BaseEnum {

    @DictData(name = "对所有人登陆用户展示", order = 10)
    LOGIN(1),
    @DictData(name = "对指定角色展示", order = 20)
    ROLE(2);

    @EnumValue
    @JsonValue
    private final int value;

    private static final Map<Integer, SysWebMenuShowType> mappings = new HashMap<>(values().length);

    static {
        for (SysWebMenuShowType item : values()) {
            mappings.put(item.getValue(), item);
        }
    }

    SysWebMenuShowType(int value) {
        this.value = value;
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static SysWebMenuShowType create(int value) {
        return mappings.get(value);
    }

    @Override
    public Integer getValue() {
        return value;
    }


}

